package club.justwill.single.persistence.dao;

import club.justwill.single.persistence.jpo.OrderItem;
import club.justwill.single.persistence.support.BaseDao;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.persistence.Query;
import java.util.List;

/**
 * Created by jaylon on 15-12-27.
 */
@Repository
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class OrderItemDao extends BaseDao<OrderItem> {
    public List<OrderItem> searchOrderItemByOrderId(long orderId){
        Query query = em.createNamedQuery("OrderItem.searchOrderItemByOrderId")
                .setParameter("orderId",orderId);
        return query.getResultList();
    }
}
